<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
  <xsl:output method="html" encoding="UTF-8"/>
  <xsl:output method="html" encoding="UTF-8" name="html"/>
  <xsl:template match="/">
    <html>
      <body>
        <h3>Bestiaire</h3>
        <ul>
          <xsl:for-each select="bestiaire/animal ">
            <li><a href="{nom}.htm"><xsl:value-of select="nom"/></a></li>
          </xsl:for-each>
        </ul>   
        <xsl:apply-templates select="bestiaire/animal"/>
      </body>
    </html>   
  </xsl:template>
   
  <xsl:template match="animal">
    <xsl:result-document format="html" encoding="UTF-8" href="{nom}.htm" >
      <html>
        <body>
          <h3><xsl:value-of select="./nom"/></h3>
          <xsl:if test="image">   
            <xsl:element name="img">
              <xsl:attribute name="align">left</xsl:attribute>
              <xsl:attribute name="width">
                <xsl:value-of select="./image/@largeur"/>
              </xsl:attribute>
              <xsl:attribute name="height">
                <xsl:value-of select="./image/@hauteur"/>
              </xsl:attribute>
              <xsl:attribute name="src">
                <xsl:value-of select="./image"/>
              </xsl:attribute>
            </xsl:element>
          </xsl:if>
          <xsl:value-of select="desc"/>
        </body>
      </html>
    </xsl:result-document>
  </xsl:template>    
</xsl:stylesheet> 